using System;
using System.Collections.Generic;
using System.Text;

namespace Krilib.Plugin
{
    abstract public class Operation
    {
        /// <summary>
        /// Parent Plugin's Identification String
        /// </summary>
        abstract public string ParentPluginId { get;}

        /// <summary>
        /// Lookup Parent Plugin
        /// </summary>
        public IPlugin ParentPlugin
        {
            get
            {
                IPlugin ret = null;
                if ((ret = Bridge.PluginManager.Lookup(ParentPluginId)) == null)
                    throw new NullReferenceException("Plugin Lookup Failed:" + ParentPluginId + " was not found.");
                return ret;
            }
        }

        /// <summary>
        /// Operation Type enumerator
        /// </summary>
        public enum OperationTypes { 
            /// <summary>
            /// Agent Operation
            /// </summary>
            Agent, 
            /// <summary>
            /// Control Operation
            /// </summary>
            Control, 
            /// <summary>
            /// Other Operation(for Expansion)
            /// </summary>
            Other }

        /// <summary>
            /// Operation Type which provided by this plugin.
        /// </summary>
        abstract public OperationTypes OperationType { get;}

        /// <summary>
        /// Plugin Begin
        /// </summary>
        abstract public void Begin();

        /// <summary>
        /// Plugin Exit
        /// </summary>
        abstract public void Exit();

        /// <summary>
        /// Get Configuration Pages For This Plugin."string" is configuration page's title.
        /// </summary>
        /// <returns>Configuration page dict</returns>
        abstract public Dictionary<string, Krilib.Control.ConfigPage> GetConfigPages();
    }
}
